package pers.qianyu.module.recommend.config;

import org.apache.mahout.cf.taste.impl.model.jdbc.MySQLJDBCDataModel;
import org.apache.mahout.cf.taste.model.DataModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.sql.DataSource;

@Configuration
public class MahoutConfig {
    @Autowired
    private DataSource dataSource;

    @Bean
    public DataModel getMySQLDataModel() {
        return new MySQLJDBCDataModel(
                dataSource,
                "user_pianhao_data1",
                "uid",
                "pid",
                "val",
                "time"
        );
    }
}